import React, { Component } from 'react'
import { View, Text,Button } from '@tarojs/components'
import Taro from '@tarojs/taro'

import { connect } from 'react-redux'
import {mapDispatchToProps} from './action'
import {wxRequest} from '@/utils/request'
import './index.less'

@connect(({my})=>({my}),mapDispatchToProps)

 class My extends Component {
  state= {
    name:'sjy'
  }
  componentWillMount () { }

  componentDidMount () { }

  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }
  change() {
    console.log(this.state.name);
    // wxRequest({
    //   url:'/lifeHome/projectListPage',
    //   data:''
    // }).then(res=>{
    //   // console.log(res);
    //   if(res.data.code==='S000000') {
    //     this.props.changeApp({myName:'哟哟哟'})
    //   }
    // })
    this.props.changeApp({myName:'哟哟哟'})
  }
  render () {
    return (
      <View className='index'>
        <Text>我是my!{this.props.my.myName}</Text>
        <Button onClick={()=>{this.change()}}>触发app的action</Button>
      </View>
    )
  }
}

export default My
